package com.itheima.pojo;

import java.io.Serializable;

public class Sports implements Serializable {
    private Integer id;
    private String code; //编码
    private String name; //运动名称
    private String time; //运动时间
    private String frequency; //运动频率
    private Integer minAge; //最小年龄
    private Integer maxAge; //最大年龄
    private String age; //年龄范围

    public Sports(String code, String name, String time, String frequency, Integer minAge, Integer maxAge) {
        this.code = code;
        this.name = name;
        this.time = time;
        this.frequency = frequency;
        this.minAge = minAge;
        this.maxAge = maxAge;
    }

    public Sports() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getFrequency() {
        return frequency;
    }

    public void setFrequency(String frequency) {
        this.frequency = frequency;
    }

    public Integer getMinAge() {
        return minAge;
    }

    public void setMinAge(Integer minAge) {
        this.minAge = minAge;
    }

    public Integer getMaxAge() {
        return maxAge;
    }

    public void setMaxAge(Integer maxAge) {
        this.maxAge = maxAge;
    }

    public String getAge() {
        if (minAge != null && maxAge != null) {
            age = minAge + "-" + maxAge + "岁";
        } else if (minAge != null && maxAge == null) {
            age = minAge + "岁以上";
        } else if (minAge == null && maxAge != null) {
            age = maxAge + "岁以下";
        } else {
            age = "暂无";
        }
        return age;
    }
}


